package com.gyj.server.entity;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.LinkedList;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * 增量注册表
 * @author Gao
 * @date 2021/6/28
 */
public class DeltaRegistry {

    /**
     * 最近变化的队列
     */
    private ConcurrentLinkedQueue<RecentlyChangedServiceInstance> recentlyChangedQueue;

    /**
     * 服务实例的总数
     */
    private Long serviceInstanceTotalCount;

    public DeltaRegistry(ConcurrentLinkedQueue<RecentlyChangedServiceInstance> recentlyChangedQueue,
                         Long serviceInstanceTotalCount) {
        this.recentlyChangedQueue = recentlyChangedQueue;
        this.serviceInstanceTotalCount = serviceInstanceTotalCount;
    }

    public ConcurrentLinkedQueue<RecentlyChangedServiceInstance> getRecentlyChangedQueue() {
        return recentlyChangedQueue;
    }
    public void setRecentlyChangedQueue(ConcurrentLinkedQueue<RecentlyChangedServiceInstance> recentlyChangedQueue) {
        this.recentlyChangedQueue = recentlyChangedQueue;
    }
    public Long getServiceInstanceTotalCount() {
        return serviceInstanceTotalCount;
    }
    public void setServiceInstanceTotalCount(Long serviceInstanceTotalCount) {
        this.serviceInstanceTotalCount = serviceInstanceTotalCount;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }

}
